home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / SMTPCEMS.ZIP / STAT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-08  |  998 b   |  46 lines

  1. //
  2. //  STAT.CPP [edit EMAIL.H before compiling]
  3. //
  4. //  This (console mode) program dislays the number 
  5. //  of email messages waiting on the SMTP server.
  6. //
  7. //  C++ version of STAT.C 
  8. //  
  9.  
  10.  
  11. #include <windows.h>
  12. #include <stdio.h>
  13. #include "see.h"
  14.  
  15. #include "email.h"
  16.  
  17. static char Buffer[512];
  18.  
  19. void ErrorExit(int Code)
  20. {seeErrorText(Code,(LPSTR)Buffer,512);
  21.  printf("SEE Error %d: %s\n", Code, Buffer);
  22.  exit(1);
  23. }
  24.  
  25. void main(int argc, char *argv[])
  26. {int Code; 
  27.  // define diagnostics log file 
  28.  seeStringParam(SEE_LOG_FILE, (LPSTR)"stat.log"); 
  29.  // connect to POP3 server 
  30.  puts("Connecting...");
  31.  Code = seePop3Connect(
  32.     (LPSTR)POP3_HOST_NAME,      
  33.     (LPSTR)POP3_USER_NAME,     
  34.     (LPSTR)POP3_PASSWORD);        
  35.  if(Code<0) ErrorExit(Code); 
  36.  // get # messages waiting  
  37.  puts("Getting message status...");
  38.  Code = seeGetEmailCount();                   
  39.  if(Code<0) ErrorExit(Code); 
  40.  printf("%d messages waiting\n", Code);
  41.  seeClose();
  42.  
  43.  
  44.  
  45.